package com.hutianao.gqgl.file.control;

import com.hutianao.gqgl.file.entity.Resp;
import com.hutianao.gqgl.file.service.FileService;
import com.hutianao.gqgl.spring.control.BaseController;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;


@Controller
@RequestMapping("/file")
public class FileController extends BaseController{
    private Logger logger = LogManager.getLogger(this.getClass());
    @Resource
    private FileService fileService;

    @RequestMapping("/filePage")
    private String filePage(){
        return "file/filePage";

    }
    @RequestMapping(value = "/upload", method = RequestMethod.POST)
    private Resp<String> upload(@RequestParam("file") MultipartFile file){
        return fileService.upload(file);
    }
}
